local sanku = fk.CreateSkill {
    name = "va_heg__sanku",
}

Fk:loadTranslationTable {
    ["va_heg__sanku"] = "三窟",
    [":va_heg__sanku"] = "当你受到伤害后，你可展示牌堆顶三张牌，若花色均不同，你获得之并回复1点体力。",

    ["#va_heg__sanku-invoke"] = "三窟：你可展示牌堆顶三张牌，若花色均不同，你获得之并回复1点体力",

    ["$va_heg__sanku1"] = "纲常难为，应存后路。",
    ["$va_heg__sanku2"] = "世将大乱，当思保全。",
}

sanku:addEffect(fk.Damaged, {
    anim_type = "drawcard",
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(sanku.name)
    end,
    on_cost = function(self, event, target, player, data)
        return player.room:askToSkillInvoke(player, { skill_name = sanku.name, prompt = "#va_heg__sanku-invoke" })
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local cards = room:getNCards(3)
        if player.dead then return end
        room:showCards(cards)
        local suits = {}
        for _, c in ipairs(cards) do
            local card = Fk:getCardById(c)
            if not table.contains(suits, card.suit) then
                table.insert(suits, card.suit)
            end
        end
        if #suits > 2 then
            room:moveCardTo(cards, Player.Hand, player)
            if player:isWounded() then
                room:recover {
                    who = player,
                    num = 1,
                    skillName = sanku.name,
                }
            end
        end
    end
})

return sanku
